import Vue from 'vue';
import VueRouter from 'vue-router';
import Layout from '@/views/logins/layout/Index.vue';
import Login from '@/views/logins/login/Index.vue';
import Home from '@/views/logins/home/Home.vue';

const Product=()=>import('@/views/logins/product/Index.vue');
const List=()=>import('@/views/logins/product/list/Index.vue');
const Category=()=>import('@/views/logins/product/category/Index.vue');

const Order=()=>import('@/views/logins/order/Index.vue');
const OrderList=()=>import('@/views/logins/order/list/Index.vue');
const Collect=()=>import('@/views/logins/order/collect/Index.vue');

const Advert=()=>import('@/views/logins/advert/Index.vue');
const AdvertList=()=>import('@/views/logins/advert/list/Index.vue');

Vue.use(VueRouter);


const routes=[
    {
        path:'/',
        component:Layout,
        children:[
            {
                path:'/',
                name:'home',
                component:Home
                //component: require('@/views/logins/layout/home/Home.vue').default
            },
            //产品管理
            {
                path:'/product',
                name:'product',
                component:Product,
                children:[
                    {
                        path:'list',//访问路径：/product/list
                        name:'list',
                        component:List
                        
                    },
                    {
                        path:'category',//访问路径：/product/category
                        name:'category',
                        component:Category
                       
                    },
                ]
            },
            //订单管理
            {
                path:'/order',
                name:'order',
                component:Order,
                children:[
                    {
                        path:'order-list',
                        name:'order-list',
                        component:OrderList
                        
                    },
                    {
                        path:'collect',
                        name:'collect',
                        component:Collect
                       
                    },
                ]
            },
             //广告管理
             {
                path:'/advert',
                name:'advert',
                component:Advert,
                children:[
                    {
                        path:'advert-list',
                        name:'advert-list',
                        component:AdvertList,
                        
                    },
                 
                ]
            },
            
        ]
    },
    {
        path:'/login',
        name:'login',
        //component: require('@/views/logins/login/Index.vue').default
        component:Login
    }
]

const router=new VueRouter({
    mode:'history',
    base:process.env.BASE_URL,
    routes
})

export default router